package com.joysuch.wwyt.risk.entity;

import cn.zlg.common.springmvc.validate.constraints.NotNull;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.joysuch.wwyt.core.support.AutoSetCommonFieldListener;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.hibernate.annotations.SQLDelete;
import org.hibernate.annotations.SQLDeleteAll;
import org.hibernate.annotations.Where;
import org.hibernate.validator.constraints.Range;
import org.springframework.data.jpa.domain.support.AuditingEntityListener;

import javax.persistence.*;
import java.time.LocalTime;

import static javax.persistence.GenerationType.IDENTITY;

/**
 * @Author ZhangDong
 * @Date 2020/7/17 12:16
 */
@EntityListeners({AuditingEntityListener.class, AutoSetCommonFieldListener.class})
@Entity
@Table(name = "wwyt_risk_eval_plan_remind")
@SQLDelete(sql = "update wwyt_risk_eval_remind set DELETE_FLAG = '1' where id= ?")
@SQLDeleteAll(sql = "update wwyt_risk_eval_remind set DELETE_FLAG = '1' where id= ?")
@Where(clause = "DELETE_FLAG = '0'")
@Data
public class RiskEvalPlanRemind {

    @Id
    @GeneratedValue(strategy = IDENTITY)
    private Long id;
    @Range(min = 0, max = 1)
    @ApiModelProperty("是否到期提醒 0 否 ; 1 是")
    @NotNull(message = "是否到期提醒不能为空")
    private Integer expireRemindOrNot;
    @ApiModelProperty("到期提醒类型")
    private String remindType;
    @JsonFormat(pattern = "HH:mm", timezone = "GMT+8")
    @ApiModelProperty("提醒时间")
    private LocalTime remindTime;
    @ApiModelProperty("评估计划类型: 0 控制风险评估计划; 1 固有风险评估计划")
    private Integer riskEvalType;

    //通用字段
    @ApiModelProperty("数据状态字段: 0 无效; 1 有效")
    @JsonIgnore
    private Integer state;
    @ApiModelProperty("创建人")
    @org.springframework.data.annotation.CreatedBy
    @JsonIgnore
    private Long createBy;
    @ApiModelProperty("创建时间")
    @org.springframework.data.annotation.CreatedDate
    @JsonIgnore
    private java.time.LocalDateTime createTime;
    @ApiModelProperty("更新人")
    @org.springframework.data.annotation.LastModifiedBy
    @JsonIgnore
    private Long updateBy;
    @ApiModelProperty("更新时间")
    @org.springframework.data.annotation.LastModifiedDate
    @JsonIgnore
    private java.time.LocalDateTime updateTime;
    @ApiModelProperty("租户")
    @JsonIgnore
    private Long tenentId;
    @ApiModelProperty("组织机构代码")
    @JsonIgnore
    private String orgCode;
    @ApiModelProperty("删除标记")
    @JsonIgnore
    private String deleteFlag;
}
